﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="FileTaggerData" namespace="FileTaggerData.Domain">
  <class name="FileTag" table="tbl_tags">
    <id name="ID" column="TAG_ID">
      <generator class="increment"/>
    </id>
    <property name="Name" column="TAG_NAME" type="System.String"/>
    <property name="Description" column="TAG_DESCRIPTION" type="System.String"/>
    <property name="Created" column="TAG_INSERTED" type="System.DateTime" insert="false" update="false"/>
    <property name="Modified" column="TAG_MODIFIED"  type="System.DateTime" insert="false" update="false"/>
    <sql-insert>
      insert into tbl_tags(tag_name,tag_description,tag_inserted,tag_modified) values (?,?,datetime(),datetime());
    </sql-insert>
    <sql-update>
      update tbl_tags set tag_name = ?, tag_description = ? , tag_modified = datetime() where tag_id = ?;
    </sql-update>
    <sql-delete>
       delete from tbl_tag_file where tag_id = @p0;
       delete from tbl_tags where tag_id = ?;
    </sql-delete>
   </class>
</hibernate-mapping>